package com.zhuang.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Classname Home
 * @Description 定义对象结构  主人的家
 * @Date 2021/3/27 16:50
 * @Created by dell
 */

public class Home {
    private List<Animal> nodeList = new ArrayList<Animal>();

    //添加方法
    public void add(Animal animal) {
        nodeList.add(animal);
    }

    public void aciton(Person person) {
        for (Animal node : nodeList) {
            node.accept(person);
        }
    }
}
